import { ApiProperty } from '@nestjs/swagger'
import { IsNotEmpty, IsNumberString, IsString, IsEmail, IsMobilePhone, IsIdentityCard } from 'class-validator'

// 定义数据传输对象
export class CreateUserDto {

  fId: string;

  @ApiProperty({ description: '后台管理用户名' })
  @IsNotEmpty({ message: '后台管理用户名不能为空' })
  fUserAccount: string;

  @ApiProperty({ description: '后台管理用户密码' })
  @IsNotEmpty({ message: '后台管理用户密码不能为空' })
  fUserPassword: string;

  @ApiProperty({ description: '后台管理用户姓名' })
  @IsNotEmpty({ message: '后台管理用户姓名不能为空' })
  fUserRealName: string;

  @ApiProperty({ description: '用户头像' })
  fUserPhoto: string;

  @ApiProperty({ description: '后台管理用户性别: 1:男;2:女;3:保密', default: 1 })
  @IsNumberString({}, { message: 'fUser_sex只能填写数字' })
  fUuserSex: string;

  @ApiProperty({ description: '后台管理用户身份证号' })
  fUserCardId: string;

  @ApiProperty({ description: '用户手机号' })
  @IsMobilePhone('zh-CN', {}, { message: '请输入争取的手机号码' })
  fUserMobile: string;

  @ApiProperty({ description: '后台管理用户手机/座机号' })
  fUserCall: string;

  @ApiProperty({ description: '后台管理用户联系邮箱' })
  @IsEmail({}, { message: '请输入正确的邮箱号' })
  fUserEmail: string;

  @ApiProperty({ description: '备注' })
  fRemark: string;

  @ApiProperty({ description: '创建时间' })
  fCreateDate: string;

  @ApiProperty({ description: '创建人' })
  fCreateId: string;

  @ApiProperty({ description: '1: 正常, 0: 禁止登录', default: 1 })
  @IsNumberString({}, { message: 'f_state只能填写数字' })
  fState: string;

  @ApiProperty({ description: '1:已删除 0:未删除', default: 0 })
  @IsNumberString({}, { message: 'f_is_del只能填写数字' })
  fIsDel: string;

  @ApiProperty({ description: '1:超级用户 0:普通用户', default: 0 })
  @IsNumberString({}, { message: 'f_is_super只能填写数字' })
  fIsSuper: string;

  @ApiProperty({ description: '1:已注册 0:未注册专家 ', default: 0 })
  @IsNumberString({}, { message: 'f_is_exp只能填写数字' })
  fIsExp: string;

  @ApiProperty({ description: '1:已注册 0:未注册普通 ', default: 0 })
  @IsNumberString({}, { message: 'f_is_nor只能填写数字' })
  fIsNor: string;
}

export class UserAccountDto {
  @ApiProperty({ description: '用户名' })
  @IsString({ message: '用户名必须为字符串' })
  @IsNotEmpty({ message: '用户名不能为空' })
  fUserAccount: string;
}

export class UserIdDto {
  @ApiProperty({ description: '用户id' })
  @IsNotEmpty({ message: 'id不能为空' })
  fId: string;
}

export class UserListDto {
  @ApiProperty({ description: '用户名', required: false })
  fName?: string;

  @ApiProperty({ description: '页码', required: false, default: 1 })
  @IsNumberString({}, { message: 'pageNum必须为数字' })
  pageNum: number;

  @ApiProperty({ description: '每页条数', required: false, default: 10 })
  @IsNotEmpty({ message: 'pageSize不能为空' })
  @IsNumberString({}, { message: 'pageSize必须为数字' })
  pageSize: number;
}